import request from '@/utils/request';

export type CommentParamsType = {
  type: 'a' | 'c';
  source: string;
};
/** 根据id获取评论数据 */
export const getCommentsByIdAPI = (params: CommentParamsType) => {
  return request({
    url: '/v1_0/comments',
    params,
  });
};

export type SendCommentParamsType = {
  target: string;
  content: string;
  art_id?: string;
};
/** 对文章或者评论进行评论 */
export const SendCommentsByIdAPI = (data: SendCommentParamsType) => {
  return request({
    url: '/v1_0/comments',
    method: 'post',
    data,
  });
};

/** 关注Api */
export function com_likingssApi(com_id: string) {
  return request({
    url: `/v1_0/comment/followings`,
    method: 'post',
    data: { target: com_id },
  });
}

/** 取消关注Api */
export function com_CancellikingsApi(com_id: string) {
  return request({
    url: `/v1_0/comment/followings/${com_id}`,
    method: 'delete',
  });
}
